package Game;

import Game.Monster.Monster;
import Game.Monster.Slime;
import Game.Player.Hero;
import Game.Player.Player;
import Game.Tool.Choose;

import java.util.Scanner;
//需要修改，怪物随机释放技能，人物获取经验、等级，加入商店/武器等。
public class Main {
    private static void Refresh(){
        Player A=new Hero();
        Monster B =new Slime();
    }
    private static void Menu(){
        System.out.println("  菜单");
        System.out.println("1----攻击");
        System.out.println("2----防御");
        System.out.println("3----技能");
        System.out.println("4----逃跑");
    }
    public static double Battle1(double M_Defense,double P_Attack,double M_Health){
        return M_Health-(P_Attack-M_Defense);
    }

    public static double Battle2(double P_Defense,double M_Attack,double P_Health){
        return P_Health-(M_Attack-P_Defense);
    }
    public static void main(String[] args) {
        int m=0;
        Hero A=new Hero();
        Slime B =new Slime();
        A.Refresh();
        for(;;){
            B.Refresh();
            for(;m==0;){
                Menu();
                Scanner Choose=new Scanner(System.in);
                int Choose1=Choose.nextInt();
                switch (Choose1){
                    case 1:
                        B.setHealth(Battle1(B.getDefense(),A.getAttack(),B.getHealth()));
                        A.setHealth(Battle2(A.getDefense(),B.getAttack(),A.getHealth()));
                        break;
                    case 2:
                        A.setDefense(A.getDefense()*2);
                        B.setHealth(Battle1(B.getDefense(),A.getAttack(),B.getHealth()));
                        A.setHealth(Battle2(A.getDefense(),B.getAttack(),A.getHealth()));
                        A.setDefense(A.getDefense()/2);
                        break;
                    case 3:
                        System.out.println("未完成");
                        break;
                    case 4:
                        m=1;
                        break;
                }
                A.Say();
                B.Say();
                if(B.getHealth()<=0||A.getHealth()<=0)break;
            }
            System.out.println("继续游戏？");
            Scanner Exit=new Scanner(System.in);
            int Choose2= Exit.nextInt();
            if(Choose2==0)break;
        }
    }
}
